package com.example.administrator.helloword.service;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log;

import com.example.administrator.helloword.R;

public class MusicService extends Service {

    MediaPlayer mp;
    @Override
    public void onCreate() {
        super.onCreate();
        Log.e("音乐开始","start");
        mp = MediaPlayer.create(this, R.raw.lin);//这时就不用调用setDataSource了
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        mp.start();
        return super.onStartCommand(intent, flags, startId);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e("音乐","销毁");
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
       return null;   }
}
